package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-09-16
 * Time: 21:46
 */
class MyThread extends Thread{
    @Override
    public void run() {
        while(true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("这里是线程1");
        }
    }
}
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        MyThread myThread =new MyThread();
        myThread.start();
        //myThread.run();
        while(true){
            Thread.sleep(1000);
            System.out.println("这里是主线程");
        }
    }
}
